package com.fatgirl.patterns.state.fusm
{
	import com.fatgirl.patterns.iterator.IIterator;
	import com.fatgirl.patterns.state.IStateControl;

	/**
	 *  
	 * 一个抽象状态类
	 * 不建议 实例化此基类
	 * @author iceman
	 * 
	 */
	internal class AbsFuSMState implements IFuSMState
	{
		protected var m_controller:IStateControl;
		private var m_parent:IFuSMState;
		private var m_type:int;
		/**
		 * 抽象状态基类 构造 
		 * @param _type 类型
		 * @param _parent 状态控制器
		 * 
		 */
		public function AbsFuSMState(_type:int,_controller:IStateControl = null)
		{
			m_type = _type;
			m_controller = _controller;
		}
		
		/**
		 * 获取状态类型ID 
		 * @return 返回类型ID
		 * 
		 */
		public function getType():int
		{
			return m_type;
		}
		/**
		 *  进入状态调用
		 * 	有需求请在子类覆盖重写默认为空
		 * 
		 */
		public function enter():void
		{
		}

		/**
		 * 状态更新调用
		 * 有需求请在子类覆盖重写默认为空 
		 * 
		 */
		public function update():void
		{
		}
		/**
		 * 离开状态调用
		 * 有需求请在子类覆盖重写默认为空
		 * 
		 */
		public function exit():void
		{
		}
		/**
		 * 状态初始化 
		 * 
		 */
		public function init():void
		{
			
		}
		public function calculateActivation():Number
		{
			return 0;
		}
		public function getParent():IFuSMState
		{
			return m_parent;
		}
		public function setParent(_parent:IFuSMState):void
		{
			m_parent = _parent;
		}
		public function checkLowerBound(_lbound:Number = 0):void
		{
			
		}
		public function checkUpperBound(_ubound:Number = 1):void
		{
			
		}
		public function checkBounds(_lb:Number = 0,_ub:Number = 1):void
		{
			
		}
	//-------------------------------------------------------------------------//
		
		public function addItem(_state:IFuSMState):void
		{
			
		}
		/**
		 * 重置状态 
		 * 
		 */
		public function reset():void
		{
			
		}
		
		/**
		 * 是否是活动状态 
		 * @param _state 状态
		 * @return 返回true或者false
		 * 
		 */
		public function isActive(_state:IFuSMState):Boolean
		{
			return false;
		}
		public function updateMachine():void
		{
			
		}
		public function iterator(_type:String = null):IIterator
		{
			return null;
		}
	}
}